#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <ctime>

using namespace std; 

typedef long long ll; 

#define N 4096

struct bigint_t {
	short d[N]; 
	int n;				//bit
	void init(ll a) {
		memset(d, 0, N*sizeof(short)); 
		n = 0; 
		while(a>0) {
			d[n++] = a%10; 
			a /= 10; 
		}
	}
}; 

struct person_t {
	ll l, r; 
}; 

void bigint_dump(bigint_t *a)
{
	if (a->n==0) {
		cout<<"0"; 
		return; 
	}
	cout<<"("<<a->n<<")";
	for (int i=a->n-1; i>=0; i--) {
		cout<<a->d[i]; 
	}
}

void mul(bigint_t *res, bigint_t *a, ll b)
{
	ll t; 
	int j=0; 
	res->init(0); 
	while(b>0) {
		t = b%10; 
		b /= 10; 
		for (int i=0; i<a->n; i++) {
			res->d[j+i] += a->d[i]*t; 
			res->n = max(res->n, j+i); 
		}
		j++; 
	}
	for (int i=0; i<res->n; i++) {
		if (res->d[i]>=10) {
			res->d[i+1] += res->d[i]/10; 
			res->d[i] %= 10; 
		} 
	}
	while(res->d[res->n]>0) {
		t = res->d[res->n]/10; 
		res->d[res->n] %= 10; 
		res->n++; 
		res->d[res->n] = t; 
	}
}

void copy(bigint_t *src, bigint_t *dst)
{
	*dst = *src; 
}

void div(bigint_t *res, bigint_t *a, ll d)
{
	ll t = 0; 
	res->init(0); 
	for (int i=a->n-1; i>=0; i--) {
		t *= 10; 
		t += a->d[i]; 
		if (t/d>0) {
			res->d[i] = t/d; 
			t %= d; 
			res->n = max(res->n, i+1); 
		}
	}
}

// a - b
int bigint_cmp(bigint_t *a, bigint_t *b) 
{
	if (a->n>b->n) {
		return 1; 
	} else if (b->n>a->n) {
		return -1; 
	} else {
		for (int i=a->n-1; i>=0; i--) {
			if(a->d[i]!=b->d[i]) {
				return a->d[i]-b->d[i]; 
			}
		}
		return 0; 
	}
}

bool bigint_eq(bigint_t *a, ll b) 
{
	for (int i=0; i<a->n; i++) {
		if (a->d[i]!=(b%10))
			return false; 
		b /= 10; 
	}
	return true; 
}

bool cmp(person_t &a, person_t &b)
{
	ll x, y; 
	x=a.l*a.r;
	y=b.l*b.r; 
	return x==y?(a.r<b.r):(x<y); 
}

bigint_t all_left_product, reward, max_reward, res; 

int main()
{
	vector<person_t> a; 
	unsigned n, i; 
	
	reward.init(0); 
	max_reward.init(0); 
	
	//freopen("p1080_1.in", "r", stdin); 
	cin>>n; 
	a.resize(n+1); 
	for (i=0; i<=n; i++) {
		cin>>a[i].l>>a[i].r; 
	}
	sort(a.begin()+1, a.end(), cmp); 
	
	all_left_product.init(a[0].l); 
	for (i=1; i<=n; i++) {
		div(&reward, &all_left_product, a[i].r); 
		if (bigint_cmp(&reward, &max_reward)>0) {
			copy(&reward, &max_reward); 
		}
		mul(&res, &all_left_product, a[i].l); 
		copy(&res, &all_left_product); 
	}
	for (int i=max_reward.n-1; i>=0; i--) {
		cout<<max_reward.d[i]; 
	}
	cout<<endl; 
	return 0; 
}


